package etxt2db.utils;

public class Pair<A,B> {
	private A first;
	private B second;
	
	public Pair(A first, B second) {
		this.first = first;
		this.second = second;
	}
	
	public void setFirst(A first) {
		this.first = first;
	}
	public A getFirst() {
		return first;
	}
	public void setSecond(B second) {
		this.second = second;
	}
	public B getSecond() {
		return second;
	}
	
	@Override
	public int hashCode(){
		return (first.hashCode()+second.hashCode())/2;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof Pair<?,?>){
			return first.equals(((Pair) obj).getFirst()) && second.equals(((Pair) obj).getSecond());
		}
		return false;
	}
	
	public String toString(){
		return "(" + first.toString() + "," + second.toString() + ")";
	}
}
